package com.jiu345.users.service.impl;

import com.jiu345.users.mapper.UserMapper;
import com.jiu345.users.pojo.Member;
import com.jiu345.users.pojo.vo.MemberVo;
import com.jiu345.users.service.IUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * package:IUserServiceImpl
 *
 * @author MrLei QQ:235921049
 * desc:用户信息
 * @Date 2024.07.05 15:17
 */
@RequiredArgsConstructor
@Service
public class IUserServiceImpl implements IUserService {
    private final UserMapper baseMapper;

    /*用户信息*/
    @Override
    public MemberVo userInfo(Long id) {
        return baseMapper.selectByUserId(id);
    }

    /*修改用户信息*/
    @Override
    public Boolean updateByBo(Member bo) {
        return baseMapper.updateById(bo) > 0;
    }

    /*修改头像*/
    @Override
    public Boolean updateAvatar(Long id, String avatar, Boolean b) {
        Member member = new Member();
        member.setId(id);
        member.setAvatar(avatar);
        return baseMapper.updateById(member) > 0;
    }
}
